<?php
declare (strict_types = 1);

namespace app\master\controller;

use app\BaseController;
use app\common\service\FinancialService\BusinessStatisticsService;
use app\common\service\FinancialService\StoreStatisticsService;
use app\common\service\OrderService\OrderReturnService;
use think\annotation\Route;
use think\annotation\route\Group;
use think\annotation\route\Middleware;
use app\common\service\GoodsService\SyncGoodsService;
use app\common\service\ConsulService\ConsulClientProvider;

/**
 * @Group("HnpayReceive")
 * @Middleware({AppRequestMiddleware::class})
 */
class HnpayReceive extends BaseController
{
    /**
     * 渠道商提现回调
     * @Route("businessWithdraw",method="POST")
     */
    public function businessWithdraw()
    {
        $post_data = $this->request->param();
        $msg=$post_data['msg'];
        $datajson=base64_decode($msg);
        $data= json_decode($datajson,true);
        $result = callApi(BusinessStatisticsService::class, 'businessWithdraw',$data);
        echo 'success';
    }

    /**
     * 分销商提现回调
     * @Route("storeWithdraw",method="POST")
     */
    public function storeWithdraw()
    {
        $post_data = $this->request->param();
        $msg=$post_data['msg'];
        $datajson=base64_decode($msg);
        $data= json_decode($datajson,true);
        $result = callApi(StoreStatisticsService::class, 'storeWithdraw',$data);
        echo 'success';
    }

    /**
     * 退款回调
     * @Route("returnOrder",method="POST")
     */
    public function returnOrder()
    {
        $post_data = $this->request->param();
        $msg=$post_data['msg'];
        $datajson=base64_decode($msg);
        $data= json_decode($datajson,true);
        $result = callApi(OrderReturnService::class, 'returnOrder',$data);
        echo 'success';
    }

}